/*
 ============================================================================
 Name		: RoImageDecoder.h
 Author	  : Leo
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CRoImageDecoder declaration
 ============================================================================
 */

#ifndef ROIMAGEDECODER_H
#define ROIMAGEDECODER_H

#include <e32base.h>	// For CActive, link against: euser.lib
#include <e32std.h>		// For RTimer, link against: euser.lib
#include<ImageConversion.h>
extern void LoadPng(RFs& aFs,const TDesC& aPath, CFbsBitmap* aBitmap, CFbsBitmap* aMask=NULL);

class MRoImageDecoderObserver 
	{
public:
	virtual int Callback(CFbsBitmap* aBitmap, CFbsBitmap* aMask=NULL)=0;
	};

class CRoImageDecoder : public CActive
	{
public:
	// Cancel and destroy
	~CRoImageDecoder();
	// Two-phased constructor.
	static CRoImageDecoder* NewL(MRoImageDecoderObserver& aObserver);
	// Two-phased constructor.
	static CRoImageDecoder* NewLC(MRoImageDecoderObserver& aObserver);	
	void Decoder(const TDesC& aPath);
private:
	// C++ constructor
	CRoImageDecoder(MRoImageDecoderObserver& aObserver);
	// Second-phase constructor
	void ConstructL();
private:
	// From CActive
	// Handle completion
	void RunL();
	// How to cancel me
	void DoCancel();
	// Override to handle leaves from RunL(). Default implementation causes
	// the active scheduler to panic.
	TInt RunError(TInt aError);
private:	
	CImageDecoder* imageDecoder;
	RFs iRfs;
	CFbsBitmap* iBitmap;
	CFbsBitmap* iMask;
	MRoImageDecoderObserver& iObserver;
	};

#endif // ROIMAGEDECODER_H
